<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use DB;

class BookListCategory extends Model
{
    protected $fillable = [
        'title',
        'deleted'
    ];

    public static function getSelectOptions()
    {
        $options = DB::table('book_list_categories')->where('deleted',0)->select('id','title as text')->get();
        $selectOption[0] = '请选择';
        foreach ($options as $option){
            $selectOption[$option->id] = $option->text;
        }
        return $selectOption;
    }
}
